﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PSLib.CodeFormating.Lexems;

namespace PSLib.CodeFormating.Formatters
{
	[Serializable]
	public class FormatConfiguration
	{
		public FormatConfiguration()
		{
			settings = new LexemConfigurationCollection();
			this.Prefix = string.Empty;
			this.Postfix = string.Empty;
		}

		public string Name { get; set; }
		public string Description { get; set; }
		public string Prefix { get; set; }
		public string Postfix { get; set; }

		public override string ToString()
		{
			string result = "FC: ";
			if (!string.IsNullOrEmpty(this.Name)) result += this.Name;
			return result;
		}

		public FormatConfiguration Clone()
		{
			FormatConfiguration result = new FormatConfiguration();
			result.Name = this.Name;
			result.Description = this.Description;
			result.Prefix = this.Prefix;
			result.Postfix = this.Postfix;

			foreach (var item in this.LexemConfigurationCollection)
				result.LexemConfigurationCollection.Add(item.Clone());
			
			return result;
		}

		public LexemConfigurationCollection LexemConfigurationCollection 
		{ 
			get { return settings; } 
		}

		LexemConfigurationCollection settings;

		
	}
}
